home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group01a.txt
/
000005_icon-group-sender _Tue May 16 12:23:51 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2002-01-03
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.9.1a/8.9.1) id MAA28222
for icon-group-addresses; Tue, 16 May 2000 12:22:54 -0700 (MST)
Message-Id: <200005161922.MAA28222@baskerville.CS.Arizona.EDU>
From: "F.G. van DORP" <F.G.van.Dorp@digimedia.nl>
X-Newsgroups: comp.lang.icon
Subject: Re: Reversible assignment really reversible ?
X-Newsreader: Forte Agent 1.7/32.534
Date: Tue, 16 May 2000 18:42:07 GMT
X-Complaints-To: abuse@chello.nl
X-Trace: flipper 958502527 212.187.67.243 (Tue, 16 May 2000 20:42:07 MET DST)
To: icon-group@optima.CS.Arizona.EDU
Errors-To: icon-group-errors@optima.CS.Arizona.EDU
Status: RO
Content-Length: 1131
On 24 Apr 2000 15:36:45 -0400, "Frank J. Lhota"
<NOSPAM.Frank.Lhota@lexma.meitech.com> wrote:
>...
My problem with reversible assignment was partly due
to an (in hindsight) obvious oversight about
the nature of resumption within backtracking.
A generator that has spent all of its results
will NOT make the whole expression fail, but will
make the subexpression(s) in front of it resume and
on their success will then resume providing its own
results all over again. See GEN2() below
#-------------------------------------------------------------------------
procedure main()
write(a:=gen1(),b:=gen2(),9<(a+b))
end
procedure gen1()
local p; p:=0
while (p<5) do {p +:=1;write("p=",p);suspend p}
end
procedure gen2()
local q; q:=4
while (q<8) do {q +:=1;write("q=",q);suspend q}
end
#------------------------------------------------------------------------
BTW,
#-------------------------------------
procedure revass(a,b)
local c; c:=a
suspend (a:=b|(a:=c, &fail))
#-------------------------------------
doesn't seem to work in the 8queens example, neither
does MYREVASS() (without the &FAIL),
but that was no big surprise.